#include<bits/stdc++.h>
using namespace std;
int n;long long r;
int a[21];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("permutation.in","r",stdin);
	freopen("permutation.out","w",stdout);
	cin >> n >> r;
	for(int i = 1;i <= n;i++)
		a[i] = i;
	if(n == 1)
	{
		cout << 1;
		return 0;
	}
	while(r--){
		bool flag;
		do{
			next_permutation(a + 1,a + n + 1);
			flag = 1;
			for(int i = 1,sm = 0;i < n;i++)
			{
				sm += a[i];
				if(sm <= a[i + 1])
					flag = 0;
			}
		}while(!flag);
	}
	for(int i = 1;i <= n;i++)
		cout << a[i] << " ";
	return 0;
}